<script setup lang="ts">
import { computed, ref } from "vue";
import { useRoute } from "vue-router";

const activeIndex = ref("1");
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};

const route = useRoute();
console.log(route);
</script>

<template>
  <div class="webgpu">
    <el-container>
      <el-aside width="200px">
        <el-menu
          :default-active="activeIndex"
          class="el-menu-vertical-demo"
          @select="handleSelect"
          router
        >
          <el-menu-item index="1" route="demo1">demo1</el-menu-item>
          <el-menu-item index="2" route="demo2">demo2</el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view :key="computed(() => String(route.name)).value" />
      </el-main>
    </el-container>
  </div>
</template>

<style lang="less" scoped>
.webgpu {
  width: 100%;
  height: 100%;
  .el-container {
    height: 100%;
    .el-main {
      padding: 0;
    }
  }
}
</style>
